<?php

use yii\helpers\Url;

/* @var $this yii\web\View */

?>

<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        <ul class="nav metismenu" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <span>
                        <img alt="image" class="img-circle" src="img/profile_small.jpg"/>
                     </span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <span class="clear">
                            <span class="block m-t-xs">
                                <strong class="font-bold"><?= Yii::$app->getUser()->getIdentity()->username ?></strong>
                            </span>
                            <span class="text-muted text-xs block">Art Director <b class="caret"></b></span>
                        </span>
                    </a>
                    <ul class="dropdown-menu animated fadeInRight m-t-xs">
                        <li><a href="profile.html">Profile</a></li>
                        <li><a href="contacts.html">Contacts</a></li>
                        <li><a href="mailbox.html">Mailbox</a></li>
                        <li class="divider"></li>
                        <li><a href="<?= Url::to(['site/logout']) ?>">注销</a></li>
                    </ul>
                </div>
                <div class="logo-element">
                    IN+
                </div>
            </li>

            <?php $datas = \common\models\Menu::getMenus($this->params['route']); ?>
            <?php foreach($datas as $data){ ?>
            <li<?php if($data['active']){ ?> class="active"<?php } ?>>
                <a href="<?= $data['url'] ?>">
                    <i class="fa <?= $data['icon'] ?>"></i> <span class="nav-label"><?= $data['name'] ?></span>
                    <?php if($data['submenu']){ ?>
                    <span class="fa arrow"></span>
                    <?php } ?>
                </a>
                <?php if($data['submenu']){ ?>
                <ul class="nav nav-second-level">
                    <?php foreach($data['submenu'] as $menu){ ?>
                    <li<?php if($menu['active']){ ?> class="active"<?php } ?>>
                        <a href="<?= $menu['url'] ?>">
                            <?= $menu['name'] ?>
                            <?php if($menu['submenu']){ ?>
                            <span class="fa arrow"></span>
                            <?php } ?>
                        </a>
                        <?php if($menu['submenu']){ ?>
                        <ul class="nav nav-third-level">
                            <?php foreach($menu['submenu'] as $submenu){ ?>
                            <li<?php if($submenu['active']){ ?> class="active"<?php } ?>><a href="<?= $submenu['url'] ?>"><?= $submenu['name'] ?></a></li>
                            <?php } ?>
                        </ul>
                        <?php } ?>
                    </li>
                    <?php } ?>
                </ul>
                <?php } ?>
            </li>
            <?php } ?>
            <li class="landing_link">
                <a target="_blank" href="landing.html"><i class="fa fa-star"></i>
                    <span class="nav-label">Landing Page</span>
                    <span class="label label-warning pull-right">NEW</span></a>
            </li>
            <li class="special_link">
                <a href="package.html"><i class="fa fa-database"></i> <span class="nav-label">Package</span></a>
            </li>
        </ul>

    </div>
</nav>